<template>
    <CommonPage :tableConfig="option" formKey="dataCoverage"></CommonPage>
    <DataCoverageAddorEdit v-model="dialog" :type="openType" :info="rowInfo"/>
</template>
<script setup>
import CommonPage from '@/components/CommonPage/index.vue'
import DataCoverageAddorEdit from './components/dataCoverageAddorEdit.vue'
import { reactive, ref } from 'vue';
const dialog = ref(false)
const openType = ref()
const rowInfo = ref()
const option = reactive({
    operationWidth: 200,
    formItems: [
        {label: '文件名称', prop: 'fileName', type: 'input', show: true},
        {label: '文件编号', prop: 'fileNo', type: 'input', show: true},
        {label: '文件状态', prop: 'fileStatus', type: 'select', show: true, options: [
            {label: '代发布', value: '1'},
            {label: '使用中', value: '2'},
            {label: '已失效', value: '3'},
            {label: '已归档', value: '4'},
        ]},
    ],
    buttons: [
        {label: "新增", icon: 'Plus', auth: '', handle:() => handleOpen('add')},
        {label: "删除", icon: 'Delete', type: 'danger', handle: (event)=> {}},
    ],
    options: [
        {label: '发布', handle: (event) => {}, isShow:() => {return true}},
        {label: '失效', handle: (event) => {}, isShow:() => {return true}},
        {label: '归档', handle: (event) => {}, isShow:() => {return true}},
        {label: '编辑', handle: (event) => handleOpen('edit', event), isShow:() => {return true}},
        {label: '删除', handle: (event) => {}, isShow:() => {return true}, type: 'danger'}
    ]
})
// 新增 编辑
const handleOpen = (type, item) => {
    openType.value = type
    item && (rowInfo.value = item)
    dialog.value = true
}
</script>